import csv

import requests

if __name__ == '__main__':
    url = "http://127.0.0.1:8081"
    # 1.读取csv文件中的用户信息
    users = csv.reader(open("users.csv", mode="r", encoding="utf-8"))
    # 2.遍历用户信息
    for user in users:
        userParam = {"username": user[0], "password": user[1]}
        loginResp = requests.post(url + "/shop/mlogin", data=userParam)
        print(loginResp.text)
        # if "success" in loginResp.text:
        #     print("测试通过")
        if user[2] in loginResp.text:

            print("测试通过")
        else:
            print("测试失败")
